<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@taglib  prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>项目</title>
</head>
<body>
	<div style="text-align: center;">
		<div style="font-size: 20px; text-align: center;">企业工单管理系统</div>
		<div style="font-size:20px; text-align: center;">选择项目:
		<select id="id">
			<c:forEach items="${projects }" var="item">
				<option value="${item.id}" >${item.project_name }</option>
			</c:forEach>
		</select></div>
		
		<button onclick="submit()">确定</button>
		
	</div>
</body>
<script type="text/javascript" src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
	function submit() {
		var id=$("#id").val();
		$.ajax({
			url:"/homework/project/AddWorkOrder",
			type:"post",
			data:{"id":id},		
			success:function(data){
				if (data.code==1) {
					location.href="/homework/project/toAddWorkOrder";
				}
			}
		})
	}
</script>
</html>